package vcp.gui.utils;

import javax.swing.JButton;





import vcp.gui.components.VCPMenu;
import vcp.gui.components.VCPPanel;

import java.awt.Color;
import java.awt.GridLayout;
import java.awt.Insets;
import java.util.ArrayList;
import java.util.Iterator;

public class MenuBuilder {
	private VCPPanel menuContainer;
	private ArrayList<Object> components;
	private Iterator<Object> it;
	
	private int width;
	private int height;
	
	public MenuBuilder(int w, int h){		
		components = new ArrayList<Object>();
		this.width = w;
		this.height = h;
	}
	
	public void addItem(Object comp){
		this.components.add(comp);
	}
	
	public VCPPanel getMenu(){
		initialize();
		return menuContainer;
	}
	
	private void initialize(){
		menuContainer = new VCPMenu();
		menuContainer.setLayout(new GridLayout(5,2,10,5));
		menuContainer.setSize(this.width,this.height);
		menuContainer.setBackground(Color.gray);
		it = components.iterator();
		while(it.hasNext())
		{
			JButton btn = (JButton)it.next();
			btn.setSize(this.width, 30);
            menuContainer.add(btn);
		}	
	}
}
